﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using SystemModule;

namespace M2Server
{
    public partial class TNormNpc
    {
        /// <summary>
        /// 跳转到脚本标签
        /// </summary>
        public void GotoLable(TPlayObject PlayObject, string sLabel, bool boExtJmp)
        {
            TStringList List1C = null;
            bool bo11;
            string sSENDMSG;
            TScript Script;
            TUserItem UserItem = null;
            m_boGotoCount++;
            if (m_boGotoCount > 850)// 防止M2不断进入GoTo而关闭
            {
                m_boGotoCount = 0;
                M2Share.MainOutMessage("[脚本异常] NPC:" + this.m_sCharName + " 位置:" + this.m_sMapName + "(" + this.m_nCurrX + ":" + this.m_nCurrY + ")");
                return;
            }
            try
            {
                Script = null;
                List1C = new TStringList();
                try
                {
                    if (PlayObject.m_NPC != this)
                    {
                        PlayObject.m_NPC = null;
                        PlayObject.m_Script = null;
                        for (int i = 0; i < PlayObject.m_nVal.Length; i++)
                        {
                            PlayObject.m_nVal[i] = 0;
                        }
                    }
           
             
                    if (Script != null)// 跳转到指定示签，执行
                    {
                        if (Script.RecordList.Count > 0)
                        {
                            if (Script.RecordList.TryGetValue(sLabel, out TSayingRecord SayingRecord))
                            {
                                if (boExtJmp && !SayingRecord.boExtJmp)
                                {
                                    return;
                                }
                                sSENDMSG = string.Empty;
                                if (SayingRecord.ProcedureList.Count > 0)
                                {
                                    foreach (var sayingProcedure in SayingRecord.ProcedureList)
                                    {
                                        if (sayingProcedure == null)
                                        {
                                            continue;
                                        }
                                        bo11 = false;
                                        if (QuestCheckCondition(PlayObject, UserItem, sayingProcedure.ConditionList))
                                        {
                                            sSENDMSG = sSENDMSG + sayingProcedure.sSayMsg;
                                            if (!QuestActionProcess(PlayObject, UserItem, sayingProcedure.ActionList))
                                            {
                                                break;
                                            }
                                            if (bo11)
                                            {
                                                SendMerChantSayMsg(PlayObject, sSENDMSG, true);
                                            }
                                        }
                                        else
                                        {
                                            sSENDMSG = sSENDMSG + sayingProcedure.sElseSayMsg;
                                            if (!QuestActionProcess(PlayObject, UserItem, sayingProcedure.ElseActionList))
                                            {
                                                break;
                                            }
                                            if (bo11)
                                            {
                                                SendMerChantSayMsg(PlayObject, sSENDMSG, true);
                                            }
                                        }
                                    }
                                }
                                if (!string.IsNullOrEmpty(sSENDMSG))
                                {
                                    SendMerChantSayMsg(PlayObject, sSENDMSG, false);
                                }
                            }
                        }
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("[异常] TNormNpc.GotoLable");
                }
            }
            finally
            {
                m_boGotoCount = 0;
                Dispose(List1C);
            }
        }

        public bool GotoLable_CheckQuestStatus(TPlayObject PlayObject, TScript ScriptInfo)
        {
            bool result = true;
            int i = 0;
            if (!ScriptInfo.boQuest)
            {
                return result;
            }
            while (true)
            {
                if ((ScriptInfo.QuestInfo[i].nRandRage > 0) && (HUtil32.Random(ScriptInfo.QuestInfo[i].nRandRage) != 0))
                {
                    result = false;
                    break;
                }
                if (PlayObject.GetQuestFalgStatus(ScriptInfo.QuestInfo[i].wFlag) != ScriptInfo.QuestInfo[i].btValue)
                {
                    result = false;
                    break;
                }
                i++;
                if (i >= 10)
                {
                    break;
                }
            }
            return result;
        }

        public TUserItem GotoLable_CheckItemW(TPlayObject PlayObject, string sItemType, int nParam)
        {
            TUserItem result;
            int nCount = 0;
            result = null;
            if (HUtil32.CompareLStr(sItemType, "[NECKLACE]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_NECKLACE];
                }
                return result;
            }
            if (HUtil32.CompareLStr(sItemType, "[RING]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_RINGL];
                }
                return result;
            }
            if (HUtil32.CompareLStr(sItemType, "[ARMRING]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_ARMRINGR];
                }
                return result;
            }
            if (HUtil32.CompareLStr(sItemType, "[WEAPON]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_WEAPON];
                }
                return result;
            }
            if (HUtil32.CompareLStr(sItemType, "[HELMET]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_HELMET];
                }
                return result;
            }
            if (HUtil32.CompareLStr(sItemType, "[ZHULI]", 4))// 斗笠
            {
                if (PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex > 0)
                {
                    result = PlayObject.m_UseItems[Grobal2.U_ZHULI];
                }
                return result;
            }
            result = PlayObject.sub_4C4CD4(sItemType, ref nCount);
            if (nCount < nParam)
            {
                result = null;
            }
            return result;
        }

        public bool GotoLable_CheckStringList(string sHumName, string sListFileName)
        {
            bool result = false;
            TStringList LoadList;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            if (File.Exists(sListFileName))
            {
                LoadList = new TStringList();
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败 => " + sListFileName);
                }
                if (LoadList.Count > 0)
                {
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        if ((LoadList[i].Trim()).ToLower().CompareTo((sHumName).ToLower()) == 0)
                        {
                            result = true;
                            break;
                        }
                    }
                }

                Dispose(LoadList);
            }
            else
            {
                M2Share.MainOutMessage("文件没有找到 => " + sListFileName);
            }
            return result;
        }

        /// <summary>
        /// 脚本执行所需条件处理
        /// </summary>
        /// <returns></returns>
        public bool QuestCheckCondition(TPlayObject PlayObject, TUserItem UserItem, IList<TQuestConditionInfo> ConditionList)
        {
            bool result = true;
            int n1C = 0;
            int nMaxDura = 0;
            int nDura = 0;
            string s01 = string.Empty;
            string s02 = string.Empty;
            string SC = string.Empty;
            if (ConditionList.Count > 0)
            {
                foreach (var QuestConditionInfo in ConditionList)
                {
                    M2Share.ScriptEngine.Execute(this, PlayObject, QuestConditionInfo, ref result);

                    switch (QuestConditionInfo.nCMDCode)
                    {
                        case M2Share.nCHECKBBCOUNT:
                            if (PlayObject.m_SlaveList.Count < QuestConditionInfo.nParam1)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKITEMW:
                            UserItem = GotoLable_CheckItemW(PlayObject, QuestConditionInfo.sParam1, QuestConditionInfo.nParam2);
                            if (UserItem == null)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nISTAKEITEM:
                            if (SC != QuestConditionInfo.sParam1)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKDURAEVA:
                            UserItem = PlayObject.QuestCheckItem(QuestConditionInfo.sParam1, ref n1C, ref nMaxDura, ref nDura);
                            if (n1C > 0)
                            {
                                if (Convert.ToInt32(HUtil32.Round((double)nMaxDura / n1C / 1000)) < QuestConditionInfo.nParam2)
                                {
                                    result = false;
                                }
                            }
                            else
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKLUCKYPOINT:
                            if (PlayObject.m_nBodyLuckLevel < QuestConditionInfo.nParam1)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKNAMELIST:
                            if (!GotoLable_CheckStringList(PlayObject.m_sCharName, m_sPath + QuestConditionInfo.sParam1))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKACCOUNTLIST:
                            if (!GotoLable_CheckStringList(PlayObject.m_sUserID, m_sPath + QuestConditionInfo.sParam1))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nCHECKIPLIST:
                            if (!GotoLable_CheckStringList(PlayObject.m_sIPaddr, m_sPath + QuestConditionInfo.sParam1))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKBONUSPOINT:
                            if (!ConditionOfCheckBonusPoint(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKACCOUNTIPLIST:
                            if (!ConditionOfCheckAccountIPList(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKGUILDLIST:
                            if (PlayObject.m_MyGuild != null)
                            {
                                if (!GotoLable_CheckStringList(PlayObject.m_MyGuild.sGuildName, m_sPath + QuestConditionInfo.sParam1))
                                {
                                    result = false;
                                }
                            }
                            else
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKVAR:
                            if (!ConditionOfCheckVar(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_ISDUPMODE:
                            if (PlayObject.m_PEnvir != null)
                            {
                                if (PlayObject.m_PEnvir.GetXYObjCount(PlayObject.m_nCurrX, PlayObject.m_nCurrY) <= 1)
                                {
                                    result = false;
                                }
                            }
                            else
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_ISOFFLINEMODE:// 检测是否是离线挂机人物
                            if (!PlayObject.m_boNotOnlineAddExp)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKSIGNMAP:// 检测人物站立时间
                            if (PlayObject.m_btLastOutStatus != 1)
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nKILLBYHUM:// 检测是否被人物所杀
                            if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                            {
                                if ((PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT) &&
                                    (PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_HEROOBJECT))
                                {
                                    result = false;
                                }
                            }
                            else
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKKIMNEEDLE:// 连击检测
                            if (!ConditionOfCHECKKIMNEEDLE(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKHUMANPULSE:
                            if (!ConditionOfCHECKHUMANPULSE(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKOPENPULSELEVEL:
                            if (!ConditionOfCHECKOPENPULSELEVEL(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKPULSELEVEL:
                            if (!ConditionOfCHECKPULSELEVEL(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKHEROOPENOPULS:
                            if (!ConditionOfCHECKHEROOPENOPULS(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKHEROPULSEXP:
                            if (!ConditionOfCHECKHEROPULSEXP(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CheckAssessMentHero:
                            // ----------双英雄命令------------------//
                            if (!ConditionOfCheckAssessMentHero(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CheckDeputyHero:
                            if (!ConditionOfCheckDeputyHero(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CheckHeroAutoPractice:
                            if (!ConditionOfCheckHeroAutoPractice(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKITMECOUNTDURA:// 检测持久物品命令
                            if (!ConditionOfCHECKITMECOUNTDURA(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                        case M2Share.nSC_CHECKSKILL75:
                            if (!ConditionOfCHECKSKILL75(PlayObject, QuestConditionInfo))
                            {
                                result = false;
                            }
                            break;
                    }
                    if (!result)
                    {
                        break;
                    }
                }
            }
            return result;
        }

        public bool GotoLable_JmpToLable(TPlayObject PlayObject, string sLabel)
        {
            bool result = false;
            PlayObject.m_nScriptGotoCount++;
            if (PlayObject.m_nScriptGotoCount > M2Share.g_Config.nScriptGotoCountLimit)
            {
                return result;
            }
            GotoLable(PlayObject, sLabel, false);
            result = true;
            return result;
        }

        public void GotoLable_GoToQuest(TPlayObject PlayObject, int nQuest)
        {
            TScript Script;
            if (m_ScriptList.Count > 0)
            {
                for (int i = 0; i < m_ScriptList.Count; i++)
                {
                    //Script = m_ScriptList[i];
                    //if (Script.nQuest == nQuest)
                    //{
                    //    PlayObject.m_Script = Script;
                    //    PlayObject.m_NPC = this;
                    //    GotoLable(PlayObject, M2Share.sMAIN, false);
                    //    break;
                    //}
                }
            }
        }

        public void GotoLable_AddList(string sHumName, string sListFileName)
        {
            TStringList LoadList;
            string s10;
            bool bo15;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            LoadList = new TStringList();
            try
            {
                if (File.Exists(sListFileName))
                {
                    try
                    {

                        LoadList.LoadFromFile(sListFileName);
                    }
                    catch
                    {
                        M2Share.MainOutMessage("文件读取失败 => " + sListFileName);
                    }
                }
                bo15 = false;
                if (LoadList.Count > 0)
                {
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        s10 = LoadList[i].Trim();
                        if ((sHumName).ToLower().CompareTo((s10).ToLower()) == 0)
                        {
                            bo15 = true;
                            break;
                        }
                    }
                }
                if (!bo15)
                {
                    LoadList.Add(sHumName);
                    try
                    {

                        LoadList.SaveToFile(sListFileName);
                    }
                    catch
                    {
                        M2Share.MainOutMessage("文件保存失败 => " + sListFileName);
                    }
                }
            }
            finally
            {
                Dispose(LoadList);
            }
        }

        public void GotoLable_DelList(string sHumName, string sListFileName)
        {
            TStringList LoadList;
            string s10;
            bool bo15;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            LoadList = new TStringList();
            if (File.Exists(sListFileName))
            {
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败.... => " + sListFileName);
                }
            }
            bo15 = false;
            if (LoadList.Count > 0)
            {
                for (int i = 0; i < LoadList.Count; i++)
                {
                    if (LoadList.Count <= 0)
                    {
                        break;
                    }
                    s10 = LoadList[i].Trim();
                    if ((sHumName).ToLower().CompareTo((s10).ToLower()) == 0)
                    {
                        LoadList.RemoveAt(i);
                        bo15 = true;
                        break;
                    }
                }
            }
            if (bo15)
            {
                try
                {
                    LoadList.SaveToFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件保存失败 => " + sListFileName);
                }
            }

            Dispose(LoadList);
        }

        public void GotoLable_TakeItem(TPlayObject PlayObject, string sItemName, int nItemCount, string sVarNo, string sHero)
        {
            TUserItem UserItem;
            TStdItem StdItem;
            int nCount;
            string SC = string.Empty;
            string sName = string.Empty;
            if ((sHero).ToLower().CompareTo(("Hero").ToLower()) == 0)
            {
                if (PlayObject.m_MyHero != null)
                {
                    try
                    {
                        sName = GetLineVariableText(PlayObject, sItemName);
                        nCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, sVarNo), 0);
                        if (nCount <= 0)
                        {
                            return;
                        }
                        if ((sName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)
                        {
                            ((THeroObject)(PlayObject.m_MyHero)).DecGold(nCount);
                            ((THeroObject)(PlayObject.m_MyHero)).GoldChanged();
                            if (M2Share.g_boGameLogGold)
                            {
                                M2Share.AddGameDataLog("10" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString()
                                    + "\09" + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09"
                                    + M2Share.sSTRING_GOLDNAME + "\09" + (nCount).ToString() + "\09" + "1" + "\09" + this.m_sCharName);
                            }
                            return;
                        }
                        try
                        {
                            for (int i = ((THeroObject)(PlayObject.m_MyHero)).m_ItemList.Count - 1; i >= 0; i--)
                            {
                                if (nCount <= 0)
                                {
                                    break;
                                }
                                if (((THeroObject)(PlayObject.m_MyHero)).m_ItemList.Count <= 0)
                                {
                                    break;
                                }
                                UserItem = (TUserItem)((THeroObject)(PlayObject.m_MyHero)).m_ItemList[i];
                                if (UserItem == null)
                                {
                                    continue;
                                }
                                if ((M2Share.UserEngine.GetStdItemName(UserItem.wIndex)).ToLower().CompareTo((sName).ToLower()) == 0)
                                {
                                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                    if (StdItem != null)
                                    {
                                        if (StdItem.NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("10" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString()
                                                + "\09" + PlayObject.m_sCharName + "\09" + sName + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString()
                                                + "/" + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString()
                                                + ")" + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString()
                                                + "/" + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")"
                                                + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString()
                                                + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString() + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString()
                                                + "/" + (UserItem.btValue[8]).ToString() + "/" + (UserItem.btValue[14]).ToString() + "\09" + this.m_sCharName);
                                        }
                                        ((THeroObject)(PlayObject.m_MyHero)).m_ItemList.RemoveAt(i);
                                        ((THeroObject)(PlayObject.m_MyHero)).SendDelItems(UserItem);
                                        UserItem = null;
                                        nCount -= 1;
                                    }
                                }
                            }
                        }
                        catch
                        {
                            M2Share.MainOutMessage("[异常] TakeItem");
                        }
                    }
                    finally
                    {
                    }
                }
            }
            else
            {
                PlayObject.m_boCanQueryBag = true;// NPC操作物品时,不能刷新包裹
                try
                {
                    sName = GetLineVariableText(PlayObject, sItemName);
                    nCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, sVarNo), 0);
                    if (nCount <= 0)
                    {
                        return;
                    }
                    if ((sName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)
                    {
                        PlayObject.DecGold(nCount);
                        PlayObject.GoldChanged();
                        if (M2Share.g_boGameLogGold)
                        {
                            M2Share.AddGameDataLog("10" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString()
                                + "\09" + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME
                                + "\09" + (nCount).ToString() + "\09" + "1" + "\09" + this.m_sCharName);
                        }
                        return;
                    }
                    try
                    {
                        for (int i = PlayObject.m_ItemList.Count - 1; i >= 0; i--)
                        {
                            if (nCount <= 0)
                            {
                                break;
                            }
                            if (PlayObject.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem)PlayObject.m_ItemList[i];
                            if (UserItem == null)
                            {
                                continue;
                            }
                            if ((M2Share.UserEngine.GetStdItemName(UserItem.wIndex)).ToLower().CompareTo((sName).ToLower()) == 0)
                            {
                                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                if (StdItem != null)
                                {
                                    if (StdItem.NeedIdentify == 1)
                                    {
                                        M2Share.AddGameDataLog("10" + "\09" + PlayObject.m_sMapName + "\09" + PlayObject.m_nCurrX + "\09" + PlayObject.m_nCurrY + "\09"
                                            + PlayObject.m_sCharName + "\09" + sName + "\09" + UserItem.MakeIndex + "\09" +
                                            "(" + HUtil32.LoWord(StdItem.DC) + "/" + HUtil32.HiWord(StdItem.DC) + ")" + "(" + HUtil32.LoWord(StdItem.MC) + "/" +
                                            HUtil32.HiWord(StdItem.MC) + ")" + "(" + HUtil32.LoWord(StdItem.SC) + "/" + HUtil32.HiWord(StdItem.SC) + ")" + "(" +
                                            HUtil32.LoWord(StdItem.AC) + "/" + HUtil32.HiWord(StdItem.AC) + ")" + "(" + HUtil32.LoWord(StdItem.MAC) + "/" +
                                            HUtil32.HiWord(StdItem.MAC) + ")" + (UserItem.btValue[0]).ToString() + "/" + UserItem.btValue[1] + "/" +
                                           UserItem.btValue[2] + "/" + UserItem.btValue[3] + "/" + UserItem.btValue[4] + "/" + UserItem.btValue[5] + "/" + UserItem.btValue[6]
                                            + "/" + UserItem.btValue[7] + "/" + UserItem.btValue[8] + "/" + UserItem.btValue[14] + "\09" + this.m_sCharName);
                                    }
                                    PlayObject.m_ItemList.RemoveAt(i);
                                    PlayObject.SendDelItems(UserItem);
                                    //SC = new string(StdItem.Name, 0, StdItem.NameLen);
                                    UserItem = null;
                                    UserItem = null;
                                    nCount -= 1;
                                }
                            }
                        }
                    }
                    catch
                    {
                        M2Share.MainOutMessage("[异常] TakeItem");
                    }
                }
                finally
                {
                    PlayObject.m_boCanQueryBag = false;// NPC操作物品时,不能刷新包裹
                }
            }
        }

        public void GotoLable_TakeWItem(TPlayObject PlayObject, string sItemName, int nItemCount)
        {
            string sName = string.Empty;
            string SC;
            if (HUtil32.CompareLStr(sItemName, "[NECKLACE]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_NECKLACE]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[RING]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_RINGL]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex = 0;
                    return;
                }
                if (PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_RINGR]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[ARMRING]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_ARMRINGL]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex = 0;
                    return;
                }
                if (PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_ARMRINGR]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[WEAPON]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_WEAPON]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[HELMET]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_HELMET]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[ZHULI]", 4))// 斗笠
            {
                if (PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_ZHULI]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[DRESS]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_DRESS]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[U_BUJUK]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_BUJUK]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[U_BELT]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_BELT].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_BELT]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BELT].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_BELT].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[U_BOOTS]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_BOOTS]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex = 0;
                    return;
                }
            }
            if (HUtil32.CompareLStr(sItemName, "[U_CHARM]", 4))
            {
                if (PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex > 0)
                {
                    PlayObject.SendDelItems(PlayObject.m_UseItems[Grobal2.U_CHARM]);
                    SC = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex);
                    PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex = 0;
                    return;
                }
            }
            for (int i = m_UseItems.GetLowerBound(0); i <= m_UseItems.GetUpperBound(0); i++)
            {
                if (nItemCount <= 0)
                {
                    return;
                }
                if (PlayObject.m_UseItems[i].wIndex > 0)
                {
                    sName = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[i].wIndex);
                    if ((sName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                    {
                        PlayObject.SendDelItems(PlayObject.m_UseItems[i]);
                        PlayObject.m_UseItems[i].wIndex = 0;
                        nItemCount -= 1;
                    }
                }
            }
        }

        public bool GotoLable_MovData_GetValNameValue(TPlayObject PlayObject, string sVarName, ref string sValue, ref int nValue, ref int nDataType)
        {
            bool result = false;
            nValue = -1;
            sValue = "";
            nDataType = -1;
            int n100 = M2Share.GetValNameNo(sVarName);
            if (n100 >= 0)
            {
                if (HUtil32.rangeInDefined(n100, 0, 99))
                {
                    nValue = PlayObject.m_nVal[n100];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 100, 199))
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 100];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 200, 299))
                {
                    nValue = PlayObject.m_DyVal[n100 - 200];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 300, 399))
                {
                    nValue = PlayObject.m_nMval[n100 - 300];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 400, 499))
                {
                    nValue = M2Share.g_Config.GlobaDyMval[n100 - 400];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 500, 599))
                {
                    nValue = PlayObject.m_nInteger[n100 - 500];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 600, 699))
                {
                    sValue = PlayObject.m_sString[n100 - 600];
                    nDataType = 0;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 700, 799))
                {
                    sValue = M2Share.g_Config.GlobalAVal[n100 - 700];
                    nDataType = 0;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 800, 1199))  // G变量
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 700];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 1200, 1599))  // A变量
                {
                    sValue = M2Share.g_Config.GlobalAVal[n100 - 1100];
                    nDataType = 0;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return result;
        }

        public bool GotoLable_MovData_GetDynamicVarValue(TPlayObject PlayObject, string sVarType, string sVarName, ref string sValue, ref int nValue, ref int nDataType)
        {
            bool result = false;
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            bool boVarFound;
            boVarFound = false;
            sValue = "";
            nValue = -1;
            nDataType = -1;
            DynamicVarList = GetDynamicVarList(PlayObject, sVarType, ref sName);
            if (DynamicVarList == null)
            {
                result = false;
                return result;
            }
            if (DynamicVarList.Count > 0)
            {
                for (int V = 0; V < DynamicVarList.Count; V++)
                {
                    DynamicVar = DynamicVarList[V];
                    if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                    {
                        switch (DynamicVar.VarType)
                        {
                            case TVarType.vInteger:
                                nValue = DynamicVar.nInternet;
                                nDataType = 1;
                                break;
                            case TVarType.vString:
                                sValue = DynamicVar.sString;
                                nDataType = 0;
                                break;
                        }
                        boVarFound = true;
                        break;
                    }
                }
            }
            if (!boVarFound)
            {
                result = false;
            }
            else
            {
                result = true;
            }
            return result;
        }

        public bool GotoLable_MovData_SetDynamicVarValue(TPlayObject PlayObject, string sVarType, string sVarName, string sValue, int nValue, int nDataType)
        {
            bool result = false;
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            bool boVarFound;
            boVarFound = false;
            DynamicVarList = GetDynamicVarList(PlayObject, sVarType, ref sName);
            if (DynamicVarList == null)
            {
                result = false;
                return result;
            }
            if (DynamicVarList.Count > 0)
            {
                for (int V = 0; V < DynamicVarList.Count; V++)
                {
                    DynamicVar = DynamicVarList[V];
                    if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                    {
                        if (nDataType == 1)
                        {
                            switch (DynamicVar.VarType)
                            {
                                case TVarType.vInteger:
                                    DynamicVar.nInternet = nValue;
                                    boVarFound = true;
                                    break;
                            }
                        }
                        else
                        {
                            switch (DynamicVar.VarType)
                            {
                                case TVarType.vString:
                                    DynamicVar.sString = sValue;
                                    boVarFound = true;
                                    break;
                            }
                        }
                    }
                }
            }
            if (!boVarFound)
            {
                result = false;
            }
            else
            {
                result = true;
            }
            return result;
        }

        public int GotoLable_MovData_GetDataType(TQuestActionInfo QuestActionInfo)
        {
            int result = -1;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            int n01;
            if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = QuestActionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = QuestActionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = QuestActionInfo.sParam3;
            }
            if (HUtil32.IsVarNumber(sParam1))
            {
                if ((sParam3 != "") && (sParam3[0] == '<') && (sParam3[sParam3.Length] == '>'))
                {
                    result = 0;
                }
                else if ((sParam3 != "") && (M2Share.GetValNameNo(sParam3) >= 0))
                {
                    result = 1;
                }
                else if ((sParam3 != "") && HUtil32.IsStringNumber(sParam3))
                {
                    result = 2;
                }
                else
                {
                    result = 3;
                }
                return result;
            }
            n01 = M2Share.GetValNameNo(sParam1);
            if (n01 >= 0)
            {
                if ((sParam2 != "") && (sParam2[0] == '<') && (sParam2[sParam2.Length - 1] == '>'))
                {
                    result = 4;
                }
                else if ((sParam2 != "") && (M2Share.GetValNameNo(sParam2) >= 0))
                {
                    result = 5;
                }
                else if ((sParam2 != "") && HUtil32.IsVarNumber(sParam2))
                {
                    result = 6;
                }
                else
                {
                    result = 7;
                }
                return result;
            }
            return result;
        }

        public void GotoLable_MovData(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            string sValue = string.Empty;
            int nValue = 0;
            int nDataType = 0;
            const string sVarFound = "变量%s不存在，变量类型:{0}";
            const string sVarTypeError = "变量类型错误，错误类型:{0} 当前支持类型(HUMAN、GUILD、GLOBAL)";
            const string sDataTypeError = "变量类型不一致，错误类型:{0} {1}";
            if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = QuestActionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = QuestActionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = QuestActionInfo.sParam3;
            }
            if (sParam1 == "")
            {
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                return;
            }
            switch (GotoLable_MovData_GetDataType(QuestActionInfo))
            {
                case 0:
                    if (ScriptBase.GetHumanInfoValue(PlayObject, sParam3, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!GotoLable_MovData_SetDynamicVarValue(PlayObject, sParam1, sParam2, sValue, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam1, sParam2 }), QuestActionInfo, M2Share.sMOV);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    }
                    return;
                case 1:
                    if (GotoLable_MovData_GetValNameValue(PlayObject, sParam3, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!GotoLable_MovData_SetDynamicVarValue(PlayObject, sParam1, sParam2, sValue, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam1, sParam2 }), QuestActionInfo, M2Share.sMOV);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    }
                    return;
                case 2:
                    if (!GotoLable_MovData_SetDynamicVarValue(PlayObject, sParam1, sParam2, QuestActionInfo.sParam3, QuestActionInfo.nParam3, 1))
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam1, sParam2 }), QuestActionInfo, M2Share.sMOV);
                    }
                    break;
                case 3:
                    if (!GotoLable_MovData_SetDynamicVarValue(PlayObject, sParam1, sParam2, QuestActionInfo.sParam3, QuestActionInfo.nParam3, 0))
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, sParam1, sParam2), QuestActionInfo, M2Share.sMOV);
                    }
                    break;
                case 4:
                    if (ScriptBase.GetHumanInfoValue(PlayObject, sParam2, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!ScriptBase.SetValNameValue(PlayObject, sParam1, sValue, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    }
                    return;
                case 5:
                    if (GotoLable_MovData_GetValNameValue(PlayObject, sParam2, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!ScriptBase.SetValNameValue(PlayObject, sParam1, sValue, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    }
                    return;
                case 6:
                    if (GotoLable_MovData_GetDynamicVarValue(PlayObject, sParam2, sParam3, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!ScriptBase.SetValNameValue(PlayObject, sParam1, sValue, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, sParam2, sParam3), QuestActionInfo, M2Share.sMOV);
                    }
                    return;
                case 7:
                    if (GotoLable_MovData_GetValNameValue(PlayObject, sParam1, ref sValue, ref nValue, ref nDataType))
                    {
                        if ((sParam2 != "") && (sParam2[0] == '<') && (sParam2[1] == '$'))  // 支持:MOV A14 <$USERALLNAME>\天下第一战士 的传值
                        {
                            ScriptBase.GetHumanInfoValue(PlayObject, sParam2, ref sValue, ref nValue, ref nDataType);// 取人物信息
                            sValue = sValue + sParam2.Substring(sParam2.IndexOf("\\") - 1, sParam2.Length - sParam2.IndexOf("\\") + 1);
                            if (!ScriptBase.SetValNameValue(PlayObject, sParam1, sValue, nValue, nDataType))
                            {
                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                                return;
                            }
                        }
                        else
                        {
                            if (!ScriptBase.SetValNameValue(PlayObject, sParam1, QuestActionInfo.sParam2, QuestActionInfo.nParam2, nDataType))
                            {
                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                                return;
                            }
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    }
                    break;
                default:
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOV);
                    break;
            }
        }

        public void GotoLable_IncInteger(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {

            int n14 = 0;
            int n3C = 0;
            int n10 = 0;
            string s01 = string.Empty;
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            bool boVarFound;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            const string sVarFound = "变量{0}不存在，变量类型:{1}";
            const string sVarTypeError = "变量类型错误，错误类型:{0} 当前支持类型(HUMAN、GUILD、GLOBAL)";
            n10 = 0;
            if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = QuestActionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = QuestActionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = QuestActionInfo.sParam3;
            }
            if ((sParam1 == "") || (sParam2 == ""))
            {
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                return;
            }
            if (sParam3 != "")
            {
                if ((!HUtil32.IsVarNumber(sParam1)) && (HUtil32.IsVarNumber(sParam2)))
                {
                    n10 = 1;
                    boVarFound = false;
                    DynamicVarList = GetDynamicVarList(PlayObject, sParam2, ref sName);
                    if (DynamicVarList == null)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sParam2 }), QuestActionInfo, M2Share.sINC);
                        return;
                    }
                    if (DynamicVarList.Count > 0)
                    {
                        for (var i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((sParam3).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        n3C = DynamicVar.nInternet;
                                        break;
                                    case TVarType.vString:
                                        s01 = DynamicVar.sString;
                                        break;
                                }
                                boVarFound = true;
                                break;
                            }
                        }
                    }
                    if (!boVarFound)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, sParam3, sParam2), QuestActionInfo, M2Share.sINC);
                        return;
                    }
                    n14 = M2Share.GetValNameNo(sParam1);
                    if (n14 >= 0)
                    {
                        if (HUtil32.rangeInDefined(n14, 0, 99))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nVal[n14] += n3C;
                            }
                            else
                            {
                                PlayObject.m_nVal[n14]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 100, 199))
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobalVal[n14 - 100] += n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobalVal[n14 - 100]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 200, 299))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_DyVal[n14 - 200] += n3C;
                            }
                            else
                            {
                                PlayObject.m_DyVal[n14 - 200]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 300, 399))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nMval[n14 - 300] += n3C;
                            }
                            else
                            {
                                PlayObject.m_nMval[n14 - 300]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 400, 499))
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobaDyMval[n14 - 400] += n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobaDyMval[n14 - 400]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 500, 599))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nInteger[n14 - 500] += n3C;
                            }
                            else
                            {
                                PlayObject.m_nInteger[n14 - 500]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 600, 699))
                        {
                            PlayObject.m_sString[n14 - 600] = PlayObject.m_sString[n14 - 600] + s01;
                        }
                        else if (HUtil32.rangeInDefined(n14, 700, 799))
                        {
                            M2Share.g_Config.GlobalAVal[n14 - 700] = M2Share.g_Config.GlobalAVal[n14 - 700] + s01;
                        }
                        else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobalVal[n14 - 700] += n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobalVal[n14 - 700]++;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                        {
                            M2Share.g_Config.GlobalAVal[n14 - 1100] = M2Share.g_Config.GlobalAVal[n14 - 1100] + s01;
                        }
                        else
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                        return;
                    }
                    return;
                }
                if ((HUtil32.IsVarNumber(sParam1)) && (!HUtil32.IsVarNumber(sParam2)))
                {
                    if ((sParam3 != "") && (!HUtil32.IsStringNumber(sParam3)))
                    {
                        n10 = 1;
                        n14 = M2Share.GetValNameNo(sParam3);
                        if (n14 >= 0)
                        {
                            if (HUtil32.rangeInDefined(n14, 0, 99))
                            {
                                n3C = PlayObject.m_nVal[n14];
                            }
                            else if (HUtil32.rangeInDefined(n14, 100, 199))
                            {
                                n3C = M2Share.g_Config.GlobalVal[n14 - 100];
                            }
                            else if (HUtil32.rangeInDefined(n14, 200, 299))
                            {
                                n3C = PlayObject.m_DyVal[n14 - 200];
                            }
                            else if (HUtil32.rangeInDefined(n14, 300, 399))
                            {
                                n3C = PlayObject.m_nMval[n14 - 300];
                            }
                            else if (HUtil32.rangeInDefined(n14, 400, 499))
                            {
                                n3C = M2Share.g_Config.GlobaDyMval[n14 - 400];
                            }
                            else if (HUtil32.rangeInDefined(n14, 500, 599))
                            {
                                n3C = PlayObject.m_nInteger[n14 - 500];
                            }
                            else if (HUtil32.rangeInDefined(n14, 600, 699))
                            {
                                s01 = PlayObject.m_sString[n14 - 600];
                            }
                            else if (HUtil32.rangeInDefined(n14, 700, 799))
                            {
                                s01 = M2Share.g_Config.GlobalAVal[n14 - 700];
                            }
                            else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                            {
                                n3C = M2Share.g_Config.GlobalVal[n14 - 700];
                            }
                            else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                            {
                                s01 = M2Share.g_Config.GlobalAVal[n14 - 1100];
                            }
                            else
                            {
                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                            }
                        }
                        else
                        {
                            s01 = sParam3;
                        }
                    }
                    else
                    {
                        n3C = QuestActionInfo.nParam3;
                    }
                    boVarFound = false;
                    DynamicVarList = GetDynamicVarList(PlayObject, sParam1, ref sName);
                    if (DynamicVarList == null)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarTypeError, sParam1), QuestActionInfo, M2Share.sINC);
                        return;
                    }
                    if (DynamicVarList.Count > 0)
                    {
                        for (var i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((sParam2).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        if (n3C > 1)
                                        {
                                            DynamicVar.nInternet += n3C;
                                        }
                                        else
                                        {
                                            DynamicVar.nInternet++;
                                        }
                                        break;
                                    case TVarType.vString:
                                        DynamicVar.sString = DynamicVar.sString + s01;
                                        break;
                                }
                                boVarFound = true;
                                break;
                            }
                        }
                    }
                    if (!boVarFound)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam2, sParam1 }), QuestActionInfo, M2Share.sINC);
                        return;
                    }
                    return;
                }
                if (n10 == 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                }
            }
            else
            {
                if ((sParam2 != "") && (!HUtil32.IsStringNumber(sParam2))) // 获取第2个变量值
                {
                    n14 = M2Share.GetValNameNo(sParam2);
                    if (n14 >= 0)
                    {
                        if (HUtil32.rangeInDefined(n14, 0, 99))
                        {
                            n3C = PlayObject.m_nVal[n14];
                        }
                        else if (HUtil32.rangeInDefined(n14, 100, 199))
                        {
                            n3C = M2Share.g_Config.GlobalVal[n14 - 100];
                        }
                        else if (HUtil32.rangeInDefined(n14, 200, 299))
                        {
                            n3C = PlayObject.m_DyVal[n14 - 200];
                        }
                        else if (HUtil32.rangeInDefined(n14, 300, 399))
                        {
                            n3C = PlayObject.m_nMval[n14 - 300];
                        }
                        else if (HUtil32.rangeInDefined(n14, 400, 499))
                        {
                            n3C = M2Share.g_Config.GlobaDyMval[n14 - 400];
                        }
                        else if (HUtil32.rangeInDefined(n14, 500, 599))
                        {
                            n3C = PlayObject.m_nInteger[n14 - 500];
                        }
                        else if (HUtil32.rangeInDefined(n14, 600, 699))
                        {
                            s01 = PlayObject.m_sString[n14 - 600];
                        }
                        else if (HUtil32.rangeInDefined(n14, 700, 799))
                        {
                            s01 = M2Share.g_Config.GlobalAVal[n14 - 700];
                        }
                        else if (HUtil32.rangeInDefined(n14, 800, 1199))//  G变量
                        {
                            n3C = M2Share.g_Config.GlobalVal[n14 - 700];
                        }
                        else if (HUtil32.rangeInDefined(n14, 1200, 1599))//  A变量(100-499)
                        {
                            s01 = M2Share.g_Config.GlobalAVal[n14 - 1100];
                        }
                        else
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                        }
                    }
                    else
                    {
                        n3C = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, sParam2), 0);//个人变量支持
                        s01 = sParam2;
                    }
                }
                else
                {
                    n3C = QuestActionInfo.nParam2;
                }
                n14 = M2Share.GetValNameNo(sParam1);
                if (n14 >= 0)
                {
                    if (HUtil32.rangeInDefined(n14, 0, 99))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nVal[n14] += n3C;
                        }
                        else
                        {
                            PlayObject.m_nVal[n14]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 100, 199))
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobalVal[n14 - 100] += n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobalVal[n14 - 100]++;
                        }

                    }
                    else if (HUtil32.rangeInDefined(n14, 200, 299))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_DyVal[n14 - 200] += n3C;
                        }
                        else
                        {
                            PlayObject.m_DyVal[n14 - 200]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 300, 399))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nMval[n14 - 300] += n3C;
                        }
                        else
                        {
                            PlayObject.m_nMval[n14 - 300]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 400, 499))
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobaDyMval[n14 - 400] += n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobaDyMval[n14 - 400]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 500, 599))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nInteger[n14 - 500] += n3C;
                        }
                        else
                        {
                            PlayObject.m_nInteger[n14 - 500]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 600, 699))
                    {
                        PlayObject.m_sString[n14 - 600] = PlayObject.m_sString[n14 - 600] + s01;
                    }
                    else
                        if (HUtil32.rangeInDefined(n14, 700, 799))
                    {
                        M2Share.g_Config.GlobalAVal[n14 - 700] = M2Share.g_Config.GlobalAVal[n14 - 700] + s01;
                    }
                    else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobalVal[n14 - 700] += n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobalVal[n14 - 700]++;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                    {
                        M2Share.g_Config.GlobalAVal[n14 - 1100] = M2Share.g_Config.GlobalAVal[n14 - 1100] + s01;
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sINC);
                    return;
                }
            }
        }

        public void GotoLable_DecInteger(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int n14 = 0;
            int n3C = 0;
            int n10 = 0;
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            string s01 = string.Empty;
            string s02 = string.Empty;
            string s03 = string.Empty;
            bool boVarFound;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            const string sVarFound = "变量{0}不存在，变量类型:{1}";
            const string sVarTypeError = "变量类型错误，错误类型:{0} 当前支持类型(HUMAN、GUILD、GLOBAL)";
            if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = QuestActionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = QuestActionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(QuestActionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(QuestActionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = QuestActionInfo.sParam3;
            }
            if ((sParam1 == "") || (sParam2 == ""))
            {
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                return;
            }
            if (sParam3 != "")
            {
                if ((!HUtil32.IsVarNumber(sParam1)) && (HUtil32.IsVarNumber(sParam2)))
                {
                    n10 = 1;
                    boVarFound = false;
                    DynamicVarList = GetDynamicVarList(PlayObject, sParam2, ref sName);
                    if (DynamicVarList == null)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarTypeError, sParam2), QuestActionInfo, M2Share.sDEC);
                        return;
                    }
                    if (DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((sParam3).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        n3C = DynamicVar.nInternet;
                                        break;
                                    case TVarType.vString:
                                        s01 = DynamicVar.sString;
                                        break;
                                }
                                boVarFound = true;
                                break;
                            }
                        }
                    }
                    if (!boVarFound)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam3, sParam2 }), QuestActionInfo, M2Share.sDEC);
                        return;
                    }
                    n14 = M2Share.GetValNameNo(sParam1);
                    if (n14 >= 0)
                    {
                        if (HUtil32.rangeInDefined(n14, 0, 99))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nVal[n14] -= n3C;
                            }
                            else
                            {
                                PlayObject.m_nVal[n14] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 100, 199))
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobalVal[n14 - 100] -= n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobalVal[n14 - 100] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 200, 299))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_DyVal[n14 - 200] -= n3C;
                            }
                            else
                            {
                                PlayObject.m_DyVal[n14 - 200] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 300, 399))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nMval[n14 - 300] -= n3C;
                            }
                            else
                            {
                                PlayObject.m_nMval[n14 - 300] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 400, 499))
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobaDyMval[n14 - 400] -= n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobaDyMval[n14 - 400] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 500, 599))
                        {
                            if (n3C > 1)
                            {
                                PlayObject.m_nInteger[n14 - 500] -= n3C;
                            }
                            else
                            {
                                PlayObject.m_nInteger[n14 - 500] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 600, 699))
                        {
                            n10 = PlayObject.m_sString[n14 - 600].IndexOf(s01);
                            //s02 = Copy(PlayObject.m_sString[n14 - 600], 1, n10 - 1);
                            //s03 = Copy(PlayObject.m_sString[n14 - 600], s01.Length + n10, PlayObject.m_sString[n14 - 600].Length);
                            PlayObject.m_sString[n14 - 600] = s02 + s03;
                        }
                        else if (HUtil32.rangeInDefined(n14, 700, 799))
                        {
                            n10 = M2Share.g_Config.GlobalAVal[n14 - 700].IndexOf(s01);
                            //s02 = Copy(M2Share.g_Config.GlobalAVal[n14 - 700], 1, n10 - 1);
                            //s03 = Copy(M2Share.g_Config.GlobalAVal[n14 - 700], s01.Length + n10, M2Share.g_Config.GlobalAVal[n14 - 700].Length);
                            M2Share.g_Config.GlobalAVal[n14 - 700] = s02 + s03;
                        }
                        else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                        {
                            if (n3C > 1)
                            {
                                M2Share.g_Config.GlobalVal[n14 - 700] -= n3C;
                            }
                            else
                            {
                                M2Share.g_Config.GlobalVal[n14 - 700] -= 1;
                            }
                        }
                        else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                        {
                            n10 = M2Share.g_Config.GlobalAVal[n14 - 1100].IndexOf(s01);
                            //s02 = Copy(M2Share.g_Config.GlobalAVal[n14 - 1100], 1, n10 - 1);
                            //s03 = Copy(M2Share.g_Config.GlobalAVal[n14 - 1100], s01.Length + n10, M2Share.g_Config.GlobalAVal[n14 - 1100].Length);
                            M2Share.g_Config.GlobalAVal[n14 - 1100] = s02 + s03;
                        }
                        else
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                        return;
                    }
                    return;
                }
                if ((HUtil32.IsVarNumber(sParam1)) && (!HUtil32.IsVarNumber(sParam2)))
                {
                    if ((sParam3 != "") && (!HUtil32.IsStringNumber(sParam3)))
                    {
                        n10 = 1;
                        n14 = M2Share.GetValNameNo(sParam3);
                        if (n14 >= 0)
                        {
                            if (HUtil32.rangeInDefined(n14, 0, 99))
                            {
                                n3C = PlayObject.m_nVal[n14];
                            }
                            else if (HUtil32.rangeInDefined(n14, 100, 199))
                            {
                                n3C = M2Share.g_Config.GlobalVal[n14 - 100];
                            }
                            else if (HUtil32.rangeInDefined(n14, 200, 299))
                            {
                                n3C = PlayObject.m_DyVal[n14 - 200];
                            }
                            else if (HUtil32.rangeInDefined(n14, 300, 399))
                            {
                                n3C = PlayObject.m_nMval[n14 - 300];
                            }
                            else if (HUtil32.rangeInDefined(n14, 400, 499))
                            {
                                n3C = M2Share.g_Config.GlobaDyMval[n14 - 400];
                            }
                            else if (HUtil32.rangeInDefined(n14, 500, 599))
                            {
                                n3C = PlayObject.m_nInteger[n14 - 500];
                            }
                            else if (HUtil32.rangeInDefined(n14, 600, 699))
                            {
                                s01 = PlayObject.m_sString[n14 - 600];
                            }
                            else if (HUtil32.rangeInDefined(n14, 700, 799))
                            {
                                s01 = M2Share.g_Config.GlobalAVal[n14 - 700];
                            }
                            else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                            {
                                n3C = M2Share.g_Config.GlobalVal[n14 - 700];
                            }
                            else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                            {
                                s01 = M2Share.g_Config.GlobalAVal[n14 - 1100];
                            }
                            else
                            {
                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                            }
                        }
                        else
                        {
                            s01 = sParam3;
                        }
                    }
                    else
                    {
                        n3C = QuestActionInfo.nParam3;
                    }
                    boVarFound = false;
                    DynamicVarList = GetDynamicVarList(PlayObject, sParam1, ref sName);
                    if (DynamicVarList == null)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sParam1 }), QuestActionInfo, M2Share.sDEC);
                        return;
                    }
                    if (DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((sParam2).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        if (n3C > 1)
                                        {
                                            DynamicVar.nInternet -= n3C;
                                        }
                                        else
                                        {
                                            DynamicVar.nInternet -= 1;
                                        }
                                        break;
                                    case TVarType.vString:
                                        n10 = DynamicVar.sString.IndexOf(s01);
                                        s02 = DynamicVar.sString.Substring(1 - 1, n10 - 1);
                                        s03 = DynamicVar.sString.Substring(s01.Length + n10 - 1, DynamicVar.sString.Length);
                                        DynamicVar.sString = s02 + s03;
                                        break;
                                }
                                boVarFound = true;
                                break;
                            }
                        }
                    }
                    if (!boVarFound)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sParam2, sParam1 }), QuestActionInfo, M2Share.sDEC);
                        return;
                    }
                    return;
                }
                if (n10 == 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                }
            }
            else
            {
                if ((sParam2 != "") && (!HUtil32.IsStringNumber(sParam2)))// 获取第2个变量值
                {
                    n14 = M2Share.GetValNameNo(sParam2);
                    if (n14 >= 0)
                    {
                        if (HUtil32.rangeInDefined(n14, 0, 99))
                        {
                            n3C = PlayObject.m_nVal[n14];
                        }
                        else if (HUtil32.rangeInDefined(n14, 100, 199))
                        {
                            n3C = M2Share.g_Config.GlobalVal[n14 - 100];
                        }
                        else if (HUtil32.rangeInDefined(n14, 200, 299))
                        {
                            n3C = PlayObject.m_DyVal[n14 - 200];
                        }
                        else if (HUtil32.rangeInDefined(n14, 300, 399))
                        {
                            n3C = PlayObject.m_nMval[n14 - 300];
                        }
                        else if (HUtil32.rangeInDefined(n14, 400, 499))
                        {
                            n3C = M2Share.g_Config.GlobaDyMval[n14 - 400];
                        }
                        else if (HUtil32.rangeInDefined(n14, 500, 599))
                        {
                            n3C = PlayObject.m_nInteger[n14 - 500];
                        }
                        else if (HUtil32.rangeInDefined(n14, 600, 699))
                        {
                            s01 = PlayObject.m_sString[n14 - 600];
                        }
                        else if (HUtil32.rangeInDefined(n14, 700, 799))
                        {
                            s01 = M2Share.g_Config.GlobalAVal[n14 - 700];
                        }
                        else if (HUtil32.rangeInDefined(n14, 800, 1199)) //G变量
                        {
                            n3C = M2Share.g_Config.GlobalVal[n14 - 700];
                        }
                        else if (HUtil32.rangeInDefined(n14, 1200, 1599))//A变量
                        {
                            s01 = M2Share.g_Config.GlobalAVal[n14 - 1100];
                        }
                        else
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                        }
                    }
                    else
                    {
                        n3C = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, sParam2), 0);//对个人变量的支持
                        s01 = sParam2;
                    }
                }
                else
                {
                    n3C = QuestActionInfo.nParam2;
                }
                n14 = M2Share.GetValNameNo(sParam1);
                if (n14 >= 0)
                {
                    if (HUtil32.rangeInDefined(n14, 0, 99))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nVal[n14] -= n3C;
                        }
                        else
                        {
                            PlayObject.m_nVal[n14] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 100, 199))
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobalVal[n14 - 100] -= n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobalVal[n14 - 100] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 200, 299))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_DyVal[n14 - 200] -= n3C;
                        }
                        else
                        {
                            PlayObject.m_DyVal[n14 - 200] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 300, 399))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nMval[n14 - 300] -= n3C;
                        }
                        else
                        {
                            PlayObject.m_nMval[n14 - 300] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 400, 499))
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobaDyMval[n14 - 400] -= n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobaDyMval[n14 - 400] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 500, 599))
                    {
                        if (n3C > 1)
                        {
                            PlayObject.m_nInteger[n14 - 500] -= n3C;
                        }
                        else
                        {
                            PlayObject.m_nInteger[n14 - 500] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 600, 699))
                    {
                        n10 = PlayObject.m_sString[n14 - 600].IndexOf(s01);
                        //s02 = Copy(PlayObject.m_sString[n14 - 600], 1, n10 - 1);
                        //s03 = Copy(PlayObject.m_sString[n14 - 600], s01.Length + n10, PlayObject.m_sString[n14 - 600].Length);
                        PlayObject.m_sString[n14 - 600] = s02 + s03;
                    }
                    else if (HUtil32.rangeInDefined(n14, 700, 799))
                    {
                        n10 = M2Share.g_Config.GlobalAVal[n14 - 700].IndexOf(s01);
                        //s02 = Copy(M2Share.g_Config.GlobalAVal[n14 - 700], 1, n10 - 1);
                        // s03 = Copy(M2Share.g_Config.GlobalAVal[n14 - 700], s01.Length + n10, M2Share.g_Config.GlobalAVal[n14 - 700].Length);
                        M2Share.g_Config.GlobalAVal[n14 - 700] = s02 + s03;
                    }
                    else if (HUtil32.rangeInDefined(n14, 800, 1199))// G变量
                    {
                        if (n3C > 1)
                        {
                            M2Share.g_Config.GlobalVal[n14 - 700] -= n3C;
                        }
                        else
                        {
                            M2Share.g_Config.GlobalVal[n14 - 700] -= 1;
                        }
                    }
                    else if (HUtil32.rangeInDefined(n14, 1200, 1599))// A变量
                    {
                        n10 = M2Share.g_Config.GlobalAVal[n14 - 1100].IndexOf(s01);
                        //s02 = Copy(M2Share.g_Config.GlobalAVal[n14 - 1100], 1, n10 - 1);
                        //s03 = Copy(M2Share.g_Config.GlobalAVal[n14 - 1100], s01.Length + n10, M2Share.g_Config.GlobalAVal[n14 - 1100].Length);
                        M2Share.g_Config.GlobalAVal[n14 - 1100] = s02 + s03;
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sDEC);
                    return;
                }
            }
        }

    }
}
